package mill.measurePoints;

import java.util.Date;

public class AirTemperature extends MeasurePoint{

	public enum TemperatureScale{
		Celsius,
		Fahrenheit,
		Kelvin		
	}
	
	private double m_measuredValue;
	private TemperatureScale m_scale;
		
	public AirTemperature(Date commisionDate, String manufacture, TemperatureScale scale) {
		super(commisionDate, manufacture);
		m_scale = scale;
	}

	public synchronized TemperatureScale get_scale() {
		return m_scale;
	}

	public synchronized void set_scale(TemperatureScale m_scale) {
		this.m_scale = m_scale;
	}

	public synchronized double get_measuredValue() {
		
		double value = 0;
		
		switch (m_scale) {
		case Celsius:
			value = m_measuredValue;
			break;
		case Fahrenheit:
			value = m_measuredValue * 1.8 + 32;
			break;
		case Kelvin:
			value = m_measuredValue + 273.15;			
			break;
		default:
			value = m_measuredValue;
			break;
		}
		
		return value;
	}
	
	public synchronized void set_measuredValue(double value) {
		m_measuredValue = value;
	}
	
	@Override
	public String toString()
	{
		return "Air Temperatur";
	
	}

}
